"use strict";

import React from "react";
import "./ErrorBar.scss" ;

class ErrorBar extends React.Component{
    constructor(props){
        super(props) ;
        this.state = {
            errorWord:this.props.errorWord||'未知错误',
            showError:false
        };
    }

    componentWillReceiveProps(nextProps) {
        this.setState({
            errorWord:nextProps.errorWord,
            showError:nextProps.showError
        });
    }

    componentDidMount() {
        //this.state.data = this.props.stepData;
    }

    render(){
        if(this.state.showError){
            return(
                <div className="error-bar error-bar-hidden">
                    <div>{this.props.errorWord}</div>
                </div>
            )
        }else {
            return (
                <div></div>
            )
        }
    }
}

export { ErrorBar as default } ;

